<?php

$enable_profiling = 1;
require_once("sys.inc");

$top = "common";
$content = "main";
$side = "main";

$country_id = 0;
if (isset($_GET["country"]) && is_numeric($_GET["country"]))
{
    $country_id = mysql_real_escape_string($_GET["country"]) + 0;
    $q = "SELECT * FROM $table_country WHERE country_id=$country_id";
    $result = mysql_query($q);
    while($row = mysql_fetch_object($result))
    {
    	$country_name = $row->country_name;
    }
}

$show_datesec = time();
$max_datesec = 0;
$date = "";
if (isset($_REQUEST["date"]))
{
	$date = $_REQUEST["date"];
	preg_match("/(\d\d\d\d)-(\d\d)-(\d\d)/", $date, $matches);
	if (count($matches) != 4)
		err("Invalid date " . $date);
	$show_datesec = gmmktime(0,0,0, $matches[2], $matches[3], $matches[1]);
	if ($show_datesec <= 0)
		err("Wrong date " . $date);
}

$plist = get_plist($country_id, $date);

require 'tpl/index.tpl';

?>